improving the responseXML coverage
diff --git a/XMLHttpRequest/abort-after-send.htm b/XMLHttpRequest/abort-after-send.htm index 32d9b58..b01190c 100644 --- a/XMLHttpRequest/abort-after-send.htm +++ b/XMLHttpRequest/abort-after-send.htm
@@ -6,6 +6,7 @@ <script src="/resources/testharnessreport.js"></script> <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-abort()-method" data-tested-assertations="following-sibling::ol/li[1] following-sibling::ol/li[3] following-sibling::ol/li[4] following-sibling::ol/li[4]/ol/li[1] following-sibling::ol/li[4]/ol/li[3] following-sibling::ol/li[4]/ol/li[4] following-sibling::ol/li[4]/ol/li[5] following-sibling::ol/li[4]/ol/li[6] following-sibling::ol/li[5]" /> <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-responsetext-attribute" data-tested-assertations="following::ol/li[3]" /> + <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-responsexml-attribute" data-tested-assertations="following::ol/li[3]" /> <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#dom-xmlhttprequest-getallresponseheaders" data-tested-assertations="following::ol/li[2]" /> <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#dom-xmlhttprequest-getresponseheader" data-tested-assertations="following::ol/li[2]" /> <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-status-attribute" data-tested-assertations="following::ol/li[2]" />
diff --git a/XMLHttpRequest/responsexml-basic.htm b/XMLHttpRequest/responsexml-basic.htm index 8dab77e..187bbd4 100644 --- a/XMLHttpRequest/responsexml-basic.htm +++ b/XMLHttpRequest/responsexml-basic.htm
@@ -4,13 +4,17 @@ <title>XMLHttpRequest: responseXML basic test</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> + <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-responsexml-attribute" data-tested-assertations="following::ol[1]/li[2] following::ol[1]/li[4]" /> + <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#document-response-entity-body" data-tested-assertations="following::ol[1]/li[1] following::ol[1]/li[6] following::ol[1]/li[10]" /> </head> <body> <div id="log"></div> <script> test(function() { var client = new XMLHttpRequest() + assert_equals(client.responseXML, null) client.open("GET", "resources/well-formed.xml", false) + assert_equals(client.responseXML, null) client.send(null) assert_equals(client.responseXML.documentElement.localName, "html", 'localName is html') assert_equals(client.responseXML.documentElement.childNodes.length, 5, 'childNodes is 5') @@ -18,6 +22,12 @@ assert_equals(client.responseXML.getElementById("n2"), null, 'getElementById("n2")') assert_equals(client.responseXML.getElementsByTagName("p")[1].namespaceURI, "namespacesarejuststrings", 'namespaceURI') }) + test(function() { + var client = new XMLHttpRequest() + client.open("GET", "resources/status.php?type=application/xml", false) + client.send(null) + assert_equals(client.responseXML, null) + }, 'responseXML on empty response documents') </script> </body> </html> diff --git a/XMLHttpRequest/responsexml-document-properties.htm b/XMLHttpRequest/responsexml-document-properties.htm index 03002d6..834fc9c 100644 --- a/XMLHttpRequest/responsexml-document-properties.htm +++ b/XMLHttpRequest/responsexml-document-properties.htm
@@ -4,6 +4,8 @@ <title>XMLHttpRequest: responseXML document properties</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> + <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-responsexml-attribute" data-tested-assertations="following::ol[1]/li[4]" /> + <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#document-response-entity-body" data-tested-assertations="following::ol[1]/li[6] following::ol[1]/li[7] following::ol[1]/li[8] following::ol[1]/li[10]" /> </head> <body> <div id="log"></div> @@ -17,6 +19,7 @@ documentURI:location.href.replace(/[^/]*$/, 'resources/well-formed.xml'), referrer:'', title:'', + contentType:'application/xml', readyState:'complete', location:null, defaultView:null,
diff --git a/XMLHttpRequest/responsexml-media-type.htm b/XMLHttpRequest/responsexml-media-type.htm index c7504d9..25b1c42 100644 --- a/XMLHttpRequest/responsexml-media-type.htm +++ b/XMLHttpRequest/responsexml-media-type.htm
@@ -4,6 +4,8 @@ <title>XMLHttpRequest: responseXML MIME type tests</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> + <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-responsexml-attribute" data-tested-assertations="following::ol[1]/li[4]" /> + <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#document-response-entity-body" data-tested-assertations="following::ol[1]/li[3] following::ol[1]/li[4] following::ol[1]/li[6] following::ol[1]/li[10]" /> </head> <body> <div id="log"></div> @@ -20,6 +22,7 @@ }, document.title + " ('" + type + "', should "+(succeed?'':'not')+" parse)") } request("", true) + request("text/html", false) request("bogus", true) request("bogus+xml", true) request("text/plain;+xml", false) diff --git a/XMLHttpRequest/responsexml-non-document-types.htm b/XMLHttpRequest/responsexml-non-document-types.htm new file mode 100644 index 0000000..e93a303 --- /dev/null +++ b/XMLHttpRequest/responsexml-non-document-types.htm
@@ -0,0 +1,28 @@ +<!doctype html> +<html> + <head> + <title>XMLHttpRequest: responseXML non document responseType</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-responsexml-attribute" data-tested-assertations="following::ol[1]/li[1]" /> + <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-responsetype-attribute" data-tested-assertations="following::ol[1]/li[4]" /> + </head> + <body> + <div id="log"></div> + <script> + function request(type) { + test(function() { + var client = new XMLHttpRequest() + client.responseType = type + client.open("GET", "resources/well-formed.xml", false) + client.send(null) + assert_throws("INVALID_STATE_ERR", function() {var x = client.responseXML}, 'throw for '+type) + }) + } + request("arraybuffer") + request("blob") + request("json") + request("text") + </script> + </body> +</html> diff --git a/XMLHttpRequest/responsexml-non-well-formed.htm b/XMLHttpRequest/responsexml-non-well-formed.htm index 9aec9f1..018666d 100644 --- a/XMLHttpRequest/responsexml-non-well-formed.htm +++ b/XMLHttpRequest/responsexml-non-well-formed.htm
@@ -4,6 +4,8 @@ <title>XMLHttpRequest: responseXML non well-formed tests</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> + <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-responsexml-attribute" data-tested-assertations="following::ol[1]/li[4]" /> + <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#document-response-entity-body" data-tested-assertations="following::ol[1]/li[6] following::ol[1]/li[10]" /> </head> <body> <div id="log"></div>